home *** CD-ROM | disk | FTP | other *** search
/ Hot Metal Pro 4.0 / Hot Metal Pro 4.0.iso / Special / text / css.txt < prev    next >
Encoding:
Text File  |  1997-11-17  |  35.6 KB  |  1,081 lines

  1.  
  2. 9. Using cascading style sheets
  3.  
  4.  
  5.  
  6. Cascading style sheets are style sheets that can be
  7. attached to individual HTML documents. Rather than having
  8. the appearance of your documents determined by the Web
  9. browser defaults, you can customize the way that users
  10. view your document. Cascading style sheets provide the
  11. most versatile control over document styles, but are
  12. not widely supported by Web browsers. At the time of
  13. this writing, Microsoft Internet Explorer (3.0 and above)
  14. and Netscape Communicator 4.0 provide the most extensive
  15. support for cascading style sheets.
  16.  
  17. You can use the HoTMetaL PRO cascading styles editor
  18. to define your own cascading styles for displaying documents.
  19.  
  20.  
  21. Style sheets must be linked to HTML documents  in order
  22. to be applied to the document by the browser. 
  23.  
  24. A cascading style sheet consists of one or more rules.
  25. There are two different types of rules: 
  26.  
  27. 1. Rules associating an element, a group of elements,
  28. a element in a particular context, or some combination
  29. of these with a set of style properties and values.
  30. This is the usual type of rule in a style sheet. 
  31.  
  32. 2. Rules used to set information about the style sheet
  33. such as its title, author, etc., as well as specifying
  34. imported style sheets and additions to the CSS standard.
  35.  
  36. The cascading part of the CSS standard refers to the
  37. fact that multiple style sheets can be applied to one
  38. document and influence how the document is displayed.
  39. A document's style sheets can have several rules that
  40. refer to the same element. There is a general scheme
  41. of how rules are to be interpreted that allows more
  42. specific rules to override more general ones, and rules
  43. that are built in to a document to override rules that
  44. are linked to a document.
  45.  
  46. The cascading style sheet standard
  47.  
  48.  The cascading style sheet standard is very flexible
  49. and quite complicated: HoTMetaL PRO supports a subset
  50. of this standard. The specifications for the evolving
  51. cascading style sheet standard can be found at the W3C
  52. Consortium's Web page at http://www.w3.org/. See the
  53. Microsoft (http://www.microsoft.com/) and Netscape 
  54. (http://www.netscape.com/)home pages for information on 
  55. their support for the CSS standard. 
  56.  
  57. 9.1. Using the cascading style sheet editor
  58.  
  59. To use the HoTMetaL PRO cascading style sheet editor:
  60.  
  61.  
  62. * Choose Cascading Style Sheets... from the Tools menu
  63. of the HoTMetaL PRO Editor or HoTMetaL PRO Information
  64. Manager.
  65.  
  66. If you launch the cascading style sheet editor from
  67. the HoTMetaL PRO Editor, and the current document is
  68. linked to a cascading style sheet file, the style sheet
  69. editor will load that file. Otherwise, a dialog box
  70. will appear, prompting you to choose a file.
  71.  
  72. * If a dialog box appears, choose an existing style
  73. sheet (.css) file, or enter a new filename to create
  74. a new file.
  75.  
  76. The style sheet editor has two modes, simple and advanced.
  77. Each mode lets you set the same style properties, but
  78. the advanced editor lets you specify more complex situations
  79. in which these style properties can be applied.
  80.  
  81. * The simple editor is the default mode when the style
  82. sheet editor is launched. If the upper right corner
  83. of the dialog box contains the [More...] button, the
  84. editor is in simple mode. In simple mode you can assign
  85. style properties to elements, classes of elements, and
  86. specific element instances.
  87.  
  88. * To put the editor in advanced mode, click on the [More...]
  89. button in the upper right corner of the dialog box;
  90. if the button reads [Less...], the editor is currently
  91. in advanced mode. In advanced mode you can create context-sensitive
  92. style properties and apply styles to groups of elements.
  93.  
  94. You should enter a title for the style sheet in the
  95. Title text box.
  96.  
  97. Once you have finished creating your style sheet, click
  98. on [Save] to save the styles you have created or modified,
  99. or [Save As...] to save the style sheet under a different
  100. name. Clicking on [Reset] discards all the changes you
  101. have made; that is, the style editor will have the content
  102. it had when the file was loaded. Click on [Exit] to
  103. dismiss the CSS editor without saving any changes.
  104.  
  105. 9.2. Attaching cascading styles to a document
  106.  
  107. There are three ways to attach cascading styles to a
  108. document: 
  109.  
  110. * Attach an external style sheet file using a LINK element.
  111.  
  112. * Embed a style sheet in the document using the STYLE
  113. element.
  114.  
  115. * Assign an inline style rule for a specific occurrence
  116. of an element, using the STYLE attribute.
  117.  
  118. 9.2.1. Attaching an external style sheet to a document
  119.  
  120. If you want a cascading style sheet file to be applied
  121. to a document, it must be linked to the document using
  122. the HoTMetaL PRO Editor. This type of link is contained
  123. in a LINK element.
  124.  
  125. * Display the Tags On view.
  126.  
  127. * If the HEAD element (at the top of the file) isn't
  128. displayed:
  129.  
  130. 1. Choose Options... from the Tools menu.
  131.  
  132. 2. Click on the View tab.
  133.  
  134. 3. Turn on Show head element.
  135.  
  136. 4. Click on [OK].
  137.  
  138. * Put the insertion point directly after the [HEAD> start-tag 
  139. (that is, don't put it inside a `head' element such as TITLE).
  140.  
  141. * Choose Element... from the Insert menu, or click on
  142. the {Insert Element} toolbar button.
  143.  
  144. * Insert a LINK element. The Insert Link dialog box
  145. will come up automatically.
  146.  
  147. * Enter the URL for the cascading style sheet (.css)
  148. file that you want to link to.
  149.  
  150. * Click on [OK].
  151.  
  152. * With the insertion point still inside the LINK element,
  153. choose Attribute Inspector from the View menu, or type
  154. [F6].
  155.  
  156. * Type `STYLESHEET' (all CAPS) in the REL field, and
  157. type [Enter].
  158.  
  159. * Optionally, enter a title for the stylesheet in the
  160. TITLE field, and type [Enter].
  161.  
  162. 9.2.2. Embedding a style sheet in a document
  163.  
  164. You can embed a cascading style sheet directly inside
  165. an HTML document using the STYLE element. The HoTMetaL
  166. PRO cascading style sheet editor does not support this
  167. method directly: you can create the style sheet as a
  168. separate file and then manually paste it into your HTML
  169. document.
  170.  
  171. * Display the Tags On view.
  172.  
  173. * If the HEAD element (at the top of the file) isn't
  174. displayed:
  175.  
  176. 1. Choose Options... from the Tools menu.
  177.  
  178. 2. Click on the View tab.
  179.  
  180. 3. Turn on Show head element.
  181.  
  182. 4. Click on [OK].
  183.  
  184. * Put the insertion point directly after the [HEAD>
  185. start-tag (that is, don't put it inside a `head' element
  186. such as TITLE).
  187.  
  188. * Choose Element... from the Insert menu, or click on
  189. the {Insert Element} toolbar button.
  190.  
  191. * Insert a STYLE element. 
  192.  
  193. * Type or paste the cascading style sheet inside the
  194. STYLE start- and end-tags. 
  195.  
  196. * With the insertion point still inside the STYLE element,
  197. choose Attribute Inspector from the View menu, or type
  198. [F6].
  199.  
  200. * Type `text/css' in the TYPE field, and type [Enter].
  201.  
  202. Because some browsers that are not CSS-compliant will
  203. display the contents of the STYLE element in the document
  204. window, it is a good idea to surround an embedded style
  205. sheet with an HTML comment. This will cause the content
  206. to be ignored by non-CSS browsers, but still interpreted
  207. by CSS compliant browsers.
  208.  
  209. * Type `<!--' just after the [STYLE>
  210. start-tag, but before the style sheet information.
  211.  
  212. * Type `-->' just before the </STYLE]
  213. end-tag, but after the style sheet information.
  214.  
  215. 9.2.3. Creating an inline style rule for an element
  216.  
  217. You can specify an inline cascading style rule for an
  218. individual instance of an element, using its STYLE element.
  219. The HoTMetaL PRO cascading style sheet editor does not
  220. support this method directly: you can create the style
  221. rule using the editor and then manually paste it into
  222. your HTML document.
  223.  
  224. * Put the insertion point inside the element to which
  225. you want to assign a style.
  226.  
  227. * Choose Attribute Inspector from the View menu, or
  228. type [F6].
  229.  
  230. * Type or paste the style rule in the STYLE field. You
  231. should enter only the `properties' part of the rule
  232. (that is, the part that appears inside the `{' and '}').
  233. For example:
  234.  
  235. <PáSTYLE="font-size:12pt;ácolor:red">Text</P>
  236.  
  237. 9.3. Setting a cascading style for an element
  238.  
  239. To assign cascading style properties to an element (that
  240. is, all elements of a particular type, for example,
  241. `all H1 elements'):
  242.  
  243. * Launch the cascading style sheet editor.
  244.  
  245. * The cascading style sheet editor should be in simple
  246. mode: it is in simple mode if the button in the upper
  247. right corner reads [More...]; if it reads [Less...],
  248. click on the button to return to simple mode.
  249.  
  250. * Select an element from the Element pull-down element
  251. list.
  252.  
  253. * Now you can use the tabbed `style properties' section
  254. of the cascading style sheet editor to set the styles
  255. for the selected element. 
  256.  
  257. 9.4. Classes and IDs
  258.  
  259. Classes provide a way of assigning a style to many element
  260. instances, possibly of different types. IDs provide
  261. a way of assigning a style to one specific occurrence
  262. of an element.
  263.  
  264. Classes
  265.  
  266. A class is simply a group of elements, possibly scattered
  267. throughout a document, all of which have the same value
  268. for their CLASS attribute. For example, if you want
  269. a document on some topic to contain both `basic' and
  270. `advanced' sections, you could give all the elements
  271. that contained advanced material the CLASS attribute
  272. value `advanced'. The advanced sections could include
  273. paragraphs, headings, images, links, and so forth. You
  274. could then use a cascading style sheet to format the
  275. `advanced' class differently: display it in a different
  276. color, or even make it invisible.
  277.  
  278. IDs
  279.  
  280. While many elements can have the same CLASS attribute
  281. value, only one element in any document can have a particular
  282. ID attribute value. IDs are intended to be unique identifiers
  283. for elements in a document: the HoTMetaL PRO Editor
  284. will not validate a file in which the same ID value
  285. is used for more than one element. Cascading style sheets
  286. let you associate an ID attribute with a set of style
  287. properties and values, so that you can format a particular
  288. element instance in a certain way. 
  289.  
  290. 9.4.1. Creating classes and IDs
  291.  
  292. You create classes and IDs in a document in the HoTMetaL
  293. PRO Editor.
  294.  
  295. To create a class, you set the CLASS attribute of as
  296. many elements you wish to the same value. 
  297.  
  298. * Put the insertion point inside an element that you
  299. want to add to a class.
  300.  
  301. * Choose Attribute Inspector from the View menu, or
  302. type [F6].
  303.  
  304. * Insert a value in the CLASS field and type [Enter].
  305.  
  306. * Repeat this for each element that you want to add
  307. to the class, using the same value for CLASS each time.
  308.  
  309. To create an ID, you set the ID attribute of one element
  310. to a unique value.
  311.  
  312. * Put the insertion point inside the element that you
  313. want to assign an ID to.
  314.  
  315. * Choose Attribute Inspector from the Markup menu, or
  316. type [F6].
  317.  
  318. * Insert a value in the ID field and type [Enter].
  319.  
  320. NOTE: Class and ID attribute values must start with
  321. a letter and can contain only letters, numbers, and
  322. `-' (hyphen). 
  323.  
  324. 9.4.2. Assigning styles to classes and IDs
  325.  
  326. To create a simple style rule associating a class or
  327. ID with a set of styles:
  328.  
  329. * Click on the [Add Class/ID...] button in the cascading
  330. style sheet editor.
  331.  
  332.  The Edit Simple Selector dialog box appears.
  333.  
  334. To specify a class:
  335.  
  336. *  Enter the CLASS attribute value in the Class text
  337. box.
  338.  
  339.  The CLASS attribute will be displayed in the Element
  340. list with an initial period (`.') to indicate that it
  341. is a CLASS attribute rule and not an element rule. 
  342.  
  343. To specify an ID:
  344.  
  345. * Enter an ID attribute value in the ID text box.
  346.  
  347.  The ID will be displayed in the Element list with an
  348. initial number sign (`#') to indicate that it is an
  349. ID attribute rule. 
  350.  
  351. * Now you can use the tabbed style properties section
  352. of the CSS Editor to set style properties  for the selected
  353. class or ID. 
  354.  
  355. NOTE: Class names and IDs that are to be used in style
  356. sheets must start with a letter and can contain only
  357. letters, numbers, and `-' (hyphen). Class names and
  358. IDs are not case-sensitive in a cascading style sheet:
  359. for example, classes called `H1b' and `h1B' are the
  360. same. A CLASS or ID rule that has no style properties
  361. associated with it will not be saved in the style sheet
  362. file.
  363.  
  364. 9.5. Setting style properties
  365.  
  366. The properties section of the CSS editor dialog box
  367. (on the right, just below the Elements list) is tabbed:
  368. set style properties by clicking on the tab and moving
  369. to the appropriate section.
  370.  
  371. Click on the Font tab to edit font properties, the Text
  372. tab to edit text properties, the Background tab to edit
  373. background properties, or the Other tab for miscellaneous
  374. properties. You can also hide parts of a document.
  375.  
  376. Many style properties have the default value inherit:
  377. this means that the value for that property will be
  378. inherited from the corresponding value (if any) for
  379. its surrounding (enclosing) element, or from the default
  380. value for that property in the browser. For example,
  381. if the font-size property of the P element were set
  382. to inherit, it would have the same font-size property
  383. as a DIV or BODY, depending on which element contained
  384. that P element.
  385.  
  386. NOTE: In properties where you must select a value and
  387. a unit measurement, you cannot enter any numeric values
  388. if the property is set to `inherit'. You have to choose
  389. the unit of measurement first.
  390.  
  391. Style specifications are applied immediately, when you
  392. change a property value. The changes can be seen in
  393. the sample text area next to the properties section.
  394. If you want to `reset' a style, do so manually; clicking
  395. on the [Reset] button reloads the entire style sheet.
  396.  
  397. 9.5.1. Font properties
  398.  
  399. Click on the Font tab of the cascading style sheet editor
  400. to edit font properties in the cascading style sheet.
  401.  
  402.  
  403. In this section, you can set the following properties:
  404.  
  405. * font-family - The fonts available on your system will
  406. be listed in the primary pull-down list. You can either
  407. choose a font from this list or type a font name (for
  408. example, Times New Roman). You can also specify a font
  409. class (such as serif). The default is inherit.
  410.  
  411. In addition to the primary font family specification,
  412. you can specify secondary font or font class specifications,
  413. which will be used if the browser viewing the file is
  414. unable to find the specified primary font family. For
  415. example, if you use the font Gill Sans as your primary
  416. font family specification, but a user is viewing your
  417. document on a PC that does not have the Gill Sans font,
  418. you may want to use a secondary specification such as
  419. sans-serif, so that even if the user is not viewing
  420. the document with the exact font that you specified,
  421. he or she is at least viewing it with a font of the
  422. same type, that is, a sans-serif font. 
  423.  
  424. Make your secondary font-family choices from the New
  425. secondary pull-down list or enter them into the text
  426. box. Then click on [Add...] to add the secondary font
  427. families to the Secondary list. These choices are ranked
  428. by order: that is, an item higher up in the Secondary
  429. list will be used first, if it is available. You can
  430. delete an entry from this list by clicking on an entry
  431. and then clicking on the [Delete] button.
  432.  
  433. * font-size - Choose a unit of measurement from the
  434. pull-down menu and enter a value for the font size.
  435. The CSS standard allows inches, centimeters, pixels,
  436. or points as units of measurement; points are usually
  437. the most appropriate unit.
  438.  
  439. * line-height - Choose a unit of measurement from the
  440. pull-down menu and enter a value for the space between
  441. the baselines of lines of text. You can choose inches,
  442. centimeters, pixels, or points, or specify a percentage
  443. of the font size. For example, if the font size were
  444. 10 points, and the line-height value were set to 120%,
  445. the space between lines would be 12 points (120% of
  446. 10 points).
  447.  
  448. * font-style - Choose inherit, normal, or italic from
  449. the pull-down list.
  450.  
  451. * font-weight - The style sheet lets you set levels
  452. of font weight, so you can, in effect, make text `more
  453. bold' and `less bold'. Selecting normal uses the default
  454. weight; selecting inherit uses the same font-weight
  455. value as the containing element. Selecting lighter or
  456. bolder decreases or increases the font weight, respectively.
  457. You can also specify font weight on a numerical scale
  458. where 100 is the lightest weight and 900 is the heaviest.
  459.  
  460. 9.5.2. Text properties
  461.  
  462. Click on the Text tab of the cascading style sheet editor
  463. to edit text properties in the cascading style sheet.
  464.  
  465.  
  466. In this section, you can set the following properties:
  467.  
  468. * margin-top, margin-right, margin-left - Set the value
  469. for the margin at the top, right, or left side of this
  470. element. (This is really only useful for `block' elements
  471. such as P.) You must first define the units for the
  472. value you enter: choose one of centimeters, inches,
  473. points or pixels from the pull-down list. If you enter
  474. a negative value, this will move the margins outward
  475. from their current setting.
  476.  
  477. * color - Specifies the color of the text. There are
  478. three ways to specify font color:
  479.  
  480. * Choose a pre-defined color from the pull-down list
  481. containing the standard 16 Windows colors.
  482.  
  483. * Choose RGB from the pull-down list and enter a color
  484. in #RRGGBB format.
  485.  
  486. * Choose a custom color by clicking on the [Custom]
  487. button: the Windows Color dialog appears.
  488.  
  489. * text-indent - Sets the indent for the first line of
  490. the element. Enter a numeric value and choose the units
  491. for the value you enter. (To indent the whole element,
  492. set a value for the margin-left property.)
  493.  
  494. * text-align (justification) - You can choose from inherit,
  495. left, center, and right.
  496.  
  497. * text-decoration - If no box is chosen, the specification
  498. is `inherit'. You can choose underline, strikethrough,
  499. or both. If none is chosen, any previous value for underline
  500. or strikethrough is overridden.
  501.  
  502. 9.5.3. Background properties
  503.  
  504. Click on the Background tab of the cascading style sheet
  505. editor to edit background properties in the cascading
  506. style sheet. 
  507.  
  508. In this section, you can set the following properties:
  509.  
  510. * background-color - Sets the background color for the
  511. specified selector group. There are three ways to specify
  512. background color:
  513.  
  514. * Choose a predefined color from the pull-down list
  515. containing the standard 16 Windows colors.
  516.  
  517. * Choose RGB from the pull-down list and enter a color
  518. in #RRGGBB format.
  519.  
  520. * Choose a custom color by clicking on the [Custom]
  521. button: the Windows Color dialog appears.
  522.  
  523. You can also use background-color to set a transparent
  524. background: just choose transparent from the pull-down
  525. list of colors.
  526.  
  527. * background-image - Enter the URL for an image file
  528. that you wish to use as a background (generally, this
  529. URL is given in relative format and specifies a file
  530. in the current directory). You can also choose an image
  531. by clicking on the [Browse...] button.
  532.  
  533. * background-repeat - Sets how the background image
  534. will repeat or `tile'. 
  535.  
  536. * repeat (the default): the background image will repeat
  537. indefinitely in both directions
  538.  
  539. * repeat-x: the background will repeat horizontally
  540. only
  541.  
  542. * repeat-y: the background image will repeat vertically
  543. only
  544.  
  545. * no-repeat: the background image will not repeat; it
  546. will only be seen once (useful for large images)
  547.  
  548. * background-attachment - Specifies whether the background
  549. image will scroll along with the browser window when
  550. the user scrolls, or whether it will remain fixed. 
  551.  
  552. * background-horizontal, background-vertical - You can
  553. specify the position of the background image by choosing
  554. a value for either or both of these specifications.
  555. background-horizontal can have the following values:
  556.  
  557. * left: positions the left edge of the background image
  558. to the left side of the browser window
  559.  
  560. * center: positions the background image in the center
  561.  
  562. * right: positions the right edge of the background
  563. image to the right side of the browser window
  564.  
  565. * percentage: you can specify the exact positioning
  566. of a background image by entering a percentage. 0% is
  567. the left edge of the browser window (and is equivalent
  568. to left); similarly, 100% specifies the right edge.
  569. 43%, for example, would position a background image
  570. just left of center.
  571.  
  572. * centimeters, inches, points, or pixels: specify an
  573. exact positioning using any of these units. The background
  574. image will be positioned the specified distance from
  575. the left edge.
  576.  
  577.  
  578.  
  579. background-vertical can have the following values:
  580.  
  581. * top: positions the top edge of the background image
  582. at the top of the browser window 
  583.  
  584. * center: positions the background image in the center
  585.  
  586. * bottom: positions the bottom edge of the background
  587. image at the bottom of the browser window
  588.  
  589. * percentage: you can specify the exact positioning
  590. of a background image by entering a percentage. 0% is
  591. the top edge of the browser window (and is equivalent
  592. to top); similarly, 100% specifies the bottom edge.
  593. 75%, for example, would position a background image
  594. near the bottom.
  595.  
  596. * centimeters, inches, points, or pixels: specify an
  597. exact positioning using any of these units. The background
  598. image will be positioned the specified distance from
  599. the top edge.
  600.  
  601. 9.5.4. Miscellaneous properties
  602.  
  603. Click on the Other tab in the cascading style sheet
  604. editor to edit some miscellaneous properties. 
  605.  
  606. This section of the cascading style sheet editor is
  607. used to:
  608.  
  609. * Enter values for property types that are new extensions
  610. to the CSS standard.
  611.  
  612. * Assign priorities to rules.
  613.  
  614. Extensions
  615.  
  616. The cascading style sheet standard is continually being
  617. upgraded. Values for new property types can often be
  618. entered using the Other section of the cascading style
  619. sheet editor. In general, you can use Other to edit
  620. a property if it can be expressed in the form: 
  621.  
  622. propertyá:ávalue
  623.  
  624. For example:
  625.  
  626. font-foundryá:áGill'sáFontáFarm
  627.  
  628. * Click on the Other tab.
  629.  
  630. * Enter the property (for example, `font-foundry') in
  631. the Other properties text box.
  632.  
  633. * Enter the value in the Value text box (for example,
  634. `Gill's Font Farm'). 
  635.  
  636. * Click on the [Save...] button in this section of the
  637. dialog box. You can delete these custom properties by
  638. clicking on the [Delete] button. 
  639.  
  640. If an extension can't be expressed in this form (that
  641. is, it requires a different syntax), you may be able
  642. to enter it using an `@? rule'.
  643.  
  644. Priorities
  645.  
  646. If certain elements are assigned styles in more than
  647. one way (for example, in the document itself and by
  648. means of an external style sheet), you can help to resolve
  649. style conflicts by choosing priorities for important
  650. styles.
  651.  
  652. * Click on the Other tab.
  653.  
  654. * Select a style property from the Property pull-down
  655. list.
  656.  
  657. * Enter a specification in the Priority text box. Entering
  658. important in this text box will make the style property
  659. you have specified more rigid and less able to be influenced
  660. by competing style specifications.
  661.  
  662. * Optionally, enter a comment in the Comments text box.
  663.  
  664. NOTE: `Priority' is currently not supported by any browser.
  665.  
  666. 9.5.5. Showing and hiding parts of a document
  667.  
  668. A style sheet can hide all instances of an HTML element,
  669. a single element instance, or all of the elements in
  670. a class. In advanced mode, you can also create a more
  671. complex rule and hide it in a style sheet. This allows
  672. you to have subsections of documents visible or hidden
  673. in different style sheets, managing your information
  674. more effectively. If the same document will be read
  675. by different audiences with somewhat different needs,
  676. then instead of having to edit the content of your document
  677. to create different versions, you can supply the different
  678. audiences the same document, but with different style
  679. sheets linked to it.
  680.  
  681. To set a `hidden' style:
  682.  
  683. * Choose an element, class, or ID from the Element list
  684. in simple mode, or choose a rule from the Edit Style
  685. Rules list in advanced mode.
  686.  
  687. * Click on the Hide Contents of Element check box.
  688.  
  689. The sample text will disappear from this dialog box,
  690. indicating that the text is hidden.
  691.  
  692. NOTE: At the time of this writing, no browsers support
  693. this feature.
  694.  
  695. 9.6. Examples of simple styles
  696.  
  697. The following sample style sheet contains three style
  698. rules that were created with the cascading style sheet
  699. editor in simple mode:
  700.  
  701. 1. The first rule states that all H1 elements will have
  702. a font size of 20 points, line height of 22 points,
  703. and be displayed in green.
  704.  
  705. 2. The second rule states that all elements in the class
  706. `student' (that is, all elements, of any type, whose
  707. CLASS attribute has the value `student') will be hidden.
  708.  
  709. 3. The third rule states that the element with ID value
  710. `para1' will be displayed in a bold, italic font. 
  711.  
  712.  
  713.  
  714. H1á{áfont-size:á20pt;áline-height:á22pt;ácolor:ágreená}
  715. .studentá{ádisplay:ánoneá}
  716. #para1á{áfont-style:áitalic;áfont-weight:áboldá}
  717.  
  718.  
  719. 9.7. Cascading styles: Advanced mode
  720.  
  721. Use the advanced mode of the cascading style sheet editor
  722. to:
  723.  
  724. * Create rules that group together several element types,
  725. elements in a particular context, classes, and  IDs.
  726.  
  727. * Assign style properties to these rules. 
  728.  
  729. * Create rules that import other style sheets, rules
  730. that specify meta-information about the style sheet,
  731. and rules that extend the capabilities of the CSS standard.
  732.  
  733. * Re-order rules with respect to oneanother.
  734.  
  735.  
  736.  
  737. To use advanced mode, click on the [More...] button
  738. in the upper right corner of the cascading style sheet
  739. editor dialog box. The dialog box expands into the advanced
  740. cascading style sheet editor.
  741.  
  742. Once you have defined a selector group (the first part
  743. of a style rule), you must set a style property before
  744. creating or editing another rule, or your selector group
  745. and rule will not be saved to the style sheet file.
  746.  
  747. 9.7.1. Creating and editing advanced rules
  748.  
  749. In simple mode you can create rules that assign style
  750. properties to a single element, a class, or an ID. 
  751.  
  752. In advanced mode you can create rules that assign style
  753. properties to a group of several selectors. `Selector'
  754. is a general term that refers both to simple items such
  755. as elements, and complex items such as an element in
  756. a specific context.
  757.  
  758. All of the defined rules are displayed in the Edit Style
  759. Rules list: that is, all of the selectors in that rule
  760. are displayed. This list also includes any rules that
  761. you created in simple mode.
  762.  
  763. To create a new rule (that is, assign selectors to the
  764. rule): 
  765.  
  766. * Click on the [New...] button.
  767.  
  768. To modify an existing rule (that is, add or delete selectors):
  769.  
  770. * Select a rule in the the Edit Style Rules list.
  771.  
  772. * Click on [Edit...].
  773.  
  774.  When you click on [New...] or [Edit...] the Edit Selectors
  775. in Rule dialog box appears. 
  776.  
  777. From this dialog box you can add the following selectors
  778. to the rule: 
  779.  
  780. * An element.
  781.  
  782. * A class or ID.
  783.  
  784. * An element in a specific context.
  785.  
  786. * An element in a specific class.
  787.  
  788. After you create a rule, you must specify style properties
  789. for it, or else it won't be saved when you save the
  790. style sheet.
  791.  
  792. To make a copy of an existing rule:
  793.  
  794. * Click on a rule in the the Edit Style Rules list.
  795.  
  796. * Click on [Copy...].
  797.  
  798. A copy of the rule is added to the Edit Style Rules
  799. list. The copy will, by default, have all of the style
  800. properties of the original.
  801.  
  802. To delete a rule:
  803.  
  804. * Click on the rule in the the Edit Style Rules list.
  805.  
  806. * Click on [Delete].
  807.  
  808. 9.7.2. Adding an element to a rule
  809.  
  810. To add an element to a rule:
  811.  
  812. * Make sure the cascading style sheet editor is in advanced
  813. mode (click on the [More...] button if it's showing).
  814.  
  815. * Click on [New...] to create a new rule, or select
  816. an existing rule from the Edit Style Rules list and
  817. click on [Edit...].
  818.  
  819. * In the Edit Selectors in Rule dialog box that appears,
  820. select an element from the Elements list.
  821.  
  822. * Move it into the Selectors in Rule list by clicking
  823. on [Add >>].
  824.  
  825. 9.7.3. Adding a class or ID to a rule
  826.  
  827. To add a class or ID to a rule:
  828.  
  829. * Make sure the cascading style sheet editor is in advanced
  830. mode (click on the [More...] button if it's showing).
  831.  
  832. * Click on [New...] to create a new rule, or select
  833. an existing rule from the Edit Style Rules list and
  834. click on [Edit...].
  835.  
  836. * In the Edit Selectors in Rule dialog box that appears,
  837. click on --Class/ID-- in the Elements list.
  838.  
  839. * Move it into the Selectors in Rule list by clicking
  840. on [Add >>].
  841.  
  842. * Click on [Edit...].
  843.  
  844. * In the Edit Simple Selector dialog box that appears,
  845. enter the Class or ID that you want to add.
  846.  
  847. * Click on [OK].
  848.  
  849. 9.7.4. Adding an element in a class to a rule
  850.  
  851. You can add an element that's in a particular class
  852. to a rule--the style properties specified for this rule
  853. will apply to the element only when it has a particular
  854. CLASS attribute value.
  855.  
  856. * Make sure the cascading style sheet editor is in advanced
  857. mode (click on the [More...] button if it's showing).
  858.  
  859. * Click on [New...] to create a new rule, or select
  860. an existing rule from the Edit Style Rules list and
  861. click on [Edit...].
  862.  
  863. * In the Edit Selectors in Rule dialog box that appears,
  864. select an element from the Elements list.
  865.  
  866. * Move it into the Selectors in Rule list by clicking
  867. on [Add >>].
  868.  
  869. * Click on [Edit...].
  870.  
  871. * In the Edit Simple Selector dialog box that appears,
  872. enter the desired Class.
  873.  
  874. * Click on [OK].
  875.  
  876. 9.7.4.1. Pseudo-classes
  877.  
  878. Another way to refine the element that you are building
  879. a style rule for is to enter a pseudo-class or pseudo-element.
  880. Pseudo-classes are not attributes, but they are characteristics
  881. of certain elements that are recognized by programs
  882. that understand the CSS standard. Currently, there are
  883. three defined pseudo-classes that work with A elements,
  884. and can be selected from the pull-down list beside the
  885. Pseudo-class text box. They are active, link, and visited,
  886. and could be used to define different styles for the
  887. A element in its unvisited, visited, and active state;
  888. for example, different colors are generally used to
  889. differentiate these different link states. Defined pseudo-classes
  890. show up in the Style rules list or Edit Selectors in
  891. Group dialog box with a colon separating the element
  892. and the pseudo-class; for example, A:active.
  893.  
  894. Pseudo-elements are used to address sub-parts of elements.
  895. For example, a pseudo-element that defines just the
  896. first letter of a paragraph has been proposed (to be
  897. used for formatting drop capitals, for example), as
  898. P:first-letter. Pseudo-elements are not currently implemented
  899. by Microsoft Internet Explorer or Netscape Navigator,
  900. but as the CSS standard evolves, more pseudo-elements
  901. will be understood by CSS-compliant programs; as this
  902. occurs, you can enter the names of newly defined pseudo-elements
  903. in the text box provided.
  904.  
  905. 9.7.5. Adding an `element in context' to a rule
  906.  
  907. Sometimes you will want a style rule to apply to an
  908. element only when it has a particular ancestor (or ancestors).
  909. For example, you might want P within DIV to have a different
  910. style than just plain P. This kind of selector is called
  911. a contextual selector.
  912.  
  913. * Make sure the cascading style sheet editor is in advanced
  914. mode (click on the [More...] button if it's showing).
  915.  
  916. * Click on [New...] to create a new rule, or select
  917. an existing rule from the Edit Style Rules list and
  918. click on [Edit...].
  919.  
  920. * In the Edit Selectors in Rule dialog box that appears,
  921. select the element whose context you wish to specify
  922. in the Elements list.
  923.  
  924. * Move it into the Selectors in Rule list by clicking
  925. on the [Add >>].
  926.  
  927. * Click on [Edit Context...].
  928.  
  929. The Edit Contextual Selector dialog box appears.
  930.  
  931.  To specify that an element should be the ancestor of
  932. the current element (in order for the styles to apply):
  933.  
  934. * Select the desired `ancestor' element from the Elements
  935. list on the left.
  936.  
  937. * Click on [Add Before>>].
  938.  
  939.  On the other hand, you can specify that an element
  940. should be the descendant of the current element:
  941.  
  942. * Select the desired `descendant' element from the Elements
  943. list on the left.
  944.  
  945. * Click on [Add After>>].
  946.  
  947. You can add as many elements as are needed to this sequence
  948. of ancestors and descendants: 
  949.  
  950. * Select an element in each of the two lists.
  951.  
  952. Now:
  953.  
  954. * Click on [Add Before>>] to make the element in the
  955. Elements list the ancestor of the element in the Contextual
  956. Selector list.
  957.  
  958. Or:
  959.  
  960. * Click on [Add After>>] to make the element in the
  961. Elements list the descendant of the element in the Contextual
  962. Selector list.
  963.  
  964. If desired, you can further refine any element in the
  965. Contextual Selector list by clicking on [Edit...] and
  966. specifying a class.
  967.  
  968. 9.7.6. Examples of advanced styles
  969.  
  970. The following sample style sheet contains three style
  971. rules that were created with the cascading style sheet
  972. editor in advanced mode.
  973.  
  974. 1. The first rule states that both H5 and H6 elements
  975. will have a font size of 14 and a line height of 16.
  976.  
  977. 2. The second rule states that a P element that is contained
  978. in a DIV element will be indented by 0.5 inches.
  979.  
  980. 3. The third rule states that a DD element in the class
  981. `student' (that is, its CLASS attribute has the value
  982. `student') will be hidden.
  983.  
  984. H5,áH6á{áfont-size:á14pt;áline-height:á16ptá}
  985. DIVáPá{átext-indent:á0.5iná}
  986. DD.studentá{ádisplay:ánoneá}
  987.  
  988. 9.7.7. Rule ordering
  989.  
  990. You can change the order of the rules in the advanced
  991. mode by selecting a rule and then clicking on the `up'
  992. or `down' arrow to move it higher or lower in the list.
  993. This ordering may affect how elements are displayed
  994. in the browser. See the cascading style sheet standard
  995. for detailed discussions of rule ordering and its impact
  996. on CSS-compliant viewer software.
  997.  
  998. 9.7.8. Importing another style sheet
  999.  
  1000. You can import another style sheet and all its rules
  1001. and elements into the current style sheet. This can
  1002. be quite useful in many ways; for example, if you have
  1003. made a `reference' style sheet for the basic styles
  1004. of your project, and would like to modify only a few
  1005. selected styles. 
  1006.  
  1007. * Make sure the cascading style sheet editor is in advanced
  1008. mode (click on the [Less...] button if it's showing).
  1009.  
  1010. * Create a new style rule by clicking on [New...].
  1011.  
  1012. * Click on the @import radio button in the Edit Selectors
  1013. in Rule dialog box. The Edit @import dialog appears.
  1014.  
  1015. * Enter the URL for the imported style sheet in the
  1016. URL text box, or click on [Browse...] to select it.
  1017.  
  1018. * Optionally, enter comments about this imported style
  1019. sheet in the Comments text box provided.
  1020.  
  1021. 9.7.9. Adding meta-information
  1022.  
  1023. A SoftQuad extension to cascading style sheets lets
  1024. you enter information for keeping track of style sheets,
  1025. versions of style sheets, etc. These `rules' are informational
  1026. only and don't affect how the browser displays documents.
  1027.  
  1028.  To enter meta-information:
  1029.  
  1030. * Make sure the cascading style sheet editor is in advanced
  1031. mode (click on the [Less...] button if it's showing).
  1032.  
  1033. * Create a new style rule by clicking on [New...].
  1034.  
  1035. * Click on the @meta radio button in the Edit Selectors
  1036. in Rule dialog box. The Edit @meta dialog appears.
  1037.  
  1038. * Enter the name of a particular kind of information
  1039. you want to enter in the Name text box, or select one
  1040. from the pull-down list.
  1041.  
  1042. * Enter the value for that piece of information in the
  1043. Value text box.
  1044.  
  1045. * Optionally, enter a comment in the Comments text box.
  1046.  
  1047. * Optionally, enter comments on the entire `@meta rule'
  1048. in the General comments text box.
  1049.  
  1050. 9.7.10. Extensions to the cascading style sheet standard
  1051.  
  1052. The cascading style sheet standard is continually being
  1053. upgraded. Values for new property types can often be
  1054. entered using the Other section  of the cascading style
  1055. sheet editor. In general, you can use Other to edit
  1056. a property if it can be expressed in the form: 
  1057.  
  1058. propertyá:ávalue
  1059.  
  1060. For example:
  1061.  
  1062. font-foundryá:áGill'sáFontáFarm
  1063.  
  1064. If an extension can't be expressed in this form (that
  1065. is, it requires a different syntax), you may be able
  1066. to enter it using an `@? rule':
  1067.  
  1068. * Make sure the cascading style sheet editor is in advanced
  1069. mode (click on the [More...] button if it's showing).
  1070.  
  1071. * Create a new style rule by clicking on [New...].
  1072.  
  1073. * Click on the @rule radio button in the Edit Selectors
  1074. in Rule dialog box. The Edit @? dialog appears.
  1075.  
  1076. * This dialog box contains a plain text box where text
  1077. of any kind can be added. Enter the new rule in this
  1078. text box. The text you enter will be written into the
  1079. style sheet exactly as you typed it.
  1080.  
  1081.